package com.zaimokuza.cn.controller;

import com.zaimokuza.cn.entity.PageResult;
import com.zaimokuza.cn.entity.action.vo.ActionInfo;
import com.zaimokuza.cn.entity.response.ResponseFormat;
import com.zaimokuza.cn.service.ActionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zaimokuza
 */
@Api(tags = "动态相关接口")
@ResponseFormat
@RestController
@RequestMapping("/action")
public class ActionController {

    @Resource
    private ActionService actionService;

    @ApiOperation(value = "查询用户动态列表", notes = "根据域名查询用户动态列表")
    @GetMapping("/page")
    public PageResult<ActionInfo> getActionPage(@RequestParam @ApiParam("用户域名") String domain,
                                                @RequestParam(defaultValue = "1") @ApiParam("当前页") Integer page,
                                                @RequestParam(defaultValue = "10") @ApiParam("每页条数") Integer size) {
        return actionService.getActionPage(domain, page, size);
    }

}
